package com.silverhaze.diamond.client.utils;

import com.silverhaze.diamond.client.Application;

/**
 * Author: Ivan Babanin
 * © Lizard Software, 2007 y.
 */
public class ServiceException extends RuntimeException {
    public ServiceException() {
        this(new Exception("Unknown exception"), "UNKNOWN EXCEPTION", "UNKNOWN EXCEPTION");
    }

    public ServiceException(String... args) {
    }

    public ServiceException(Exception e, String... args) {
        String[] temp = new String[args.length + 1];
        System.arraycopy(args, 0, temp, 0, temp.length - 1);
        temp[args.length] = e.getMessage();
    }

    public ServiceException(Exception e, boolean killExecution, String... args) {
        this(e, args);

        if (killExecution) {
            Application.specialFinish();
        }
    }
}

